<?php

namespace app\common\validate;
use think\Validate;

class Product extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'cate_id'        => 'require',
        'title'          => 'require',
        'image'          => 'require',
        'introduction'   => 'require',
        'content'        => 'require',
        'url'       =>'requireIf:type,',
    ];

    /**
     * 提示消息
     */
    protected $message = [];

    /**
     * 字段描述
     */
    protected $field = [
        'title'         => '标题',
        'image'         => '图片',
        'introduction'  => '小标题',
        'cate_id'       => '分类',
        'url'           => '项目访问地址',
        'content'       => '项目简介',
    ];

    protected $scene = [
        'add'   =>  ['title', 'image', 'introduction', 'cate_id', 'content'],
        'edit'  =>  ['title', 'image', 'introduction', 'cate_id', 'content'],
    ];
}
